﻿using System;
using System.Collections.Generic;

namespace SimpleORM
{
    public class ObjectContextDictionary : Dictionary<Type, ObjectContext>
    {
        #region Fields

        #endregion

        #region Methods

        #region Methods - Public

        public ObjectContext Get(Type type)
        {
            if (!this.ContainsKey(type))
                this[type] = ObjectContext.Create(type).Clone() as ObjectContext;

            return this[type];
        }

        public ObjectContext Set(ObjectContext oc)
        {
            this[oc.ElementType] = oc;

            return oc;
        }

        #endregion

        #endregion
    }
}
